﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DO.DreamOnTrader;

namespace DO.DreamOnTrader.Trigger
{
	public enum ActionSet { BUY = 0, SELL = -1 }

	public class Signal
	{
		public Signal(Product _product, string _mth, int _qty, ActionSet _act, DateTime _datetime, float _actprice, float _price = float.NaN)
		{
			product = _product;
			Qty = _qty;
			action = _act;
			dateTime = _datetime;
			price = _price;
			actPrice = _actprice;
			mth = _mth;
		}

		/// <summary>
		/// 買/賣
		/// </summary>
		public ActionSet action { get; private set; }
		
		/// <summary>
		/// 訊號之買賣商品
		/// </summary>
		public Product product { get; private set; }

		/// <summary>
		/// 此訊號要交易的口數
		/// </summary>
		public int Qty { get; private set; }

		/// <summary>
		/// 此訊號發生時間
		/// </summary>
		public DateTime dateTime { get; private set; }
		
		/// <summary>
		/// 訊號之委託價
		/// </summary>
		public float price { get; private set; }
		
		/// <summary>
		/// 此訊號交易商品之交割月份
		/// </summary>
		public string mth { get; private set; }

		/// <summary>
		/// 產生訊號時的報價
		/// </summary>
		public float actPrice { get; private set; }

		public override string ToString()
		{
			return "觸發時間:" + dateTime.ToString("yyyy/MM/dd HH:mm:ss") + " ," + action.ToString() + "," + mth + product.ProductName + " 當時價格:" + actPrice.ToString();
		}

	}
}
